#include "criminal.h"


extern volatile int mouse_x;
extern volatile int mouse_y;
extern volatile int mouse_z;
extern volatile int mouse_b;


void load_images(image *image1, image *image2, image *image3, image *image4, image *image5, image *image6, image *image7, image *image8, image *image9, image *image10, image *image11, image *image12, BITMAP *GO, box *box1, box *box2, box *box3, box *box4, box *box5, box *box6, box *box7, BITMAP *curseur)
{
image1->img = load_bitmap("knife.bmp", NULL);
image2->img = load_bitmap("mask.bmp", NULL);
image3->img = load_bitmap("bloody_saw.bmp", NULL);
image4->img = load_bitmap("watch.bmp", NULL);
image5->img = load_bitmap("gun.bmp", NULL);
image6->img = load_bitmap("blood.bmp", NULL);
image7->img = load_bitmap("tooth.bmp", NULL);
image8->img = load_bitmap("notes.bmp", NULL);
image9->img = load_bitmap("magnet.bmp", NULL);
image10->img = load_bitmap("hammer.bmp", NULL);
image11->img = load_bitmap("photos.bmp", NULL);
image12->img = load_bitmap("spray.bmp", NULL);

 box1->bx = load_bitmap("box1.bmp" , NULL);
box2->bx = load_bitmap("box2.bmp" , NULL);
box3->bx = load_bitmap("box3.bmp" , NULL);
box4->bx = load_bitmap("box4.bmp" , NULL);
box5->bx = load_bitmap("box5.bmp" , NULL);
box6->bx = load_bitmap("box6.bmp" , NULL);
box7->bx = load_bitmap("box7.bmp" , NULL);


//GO = load_bitmap("game-over.bmp" , NULL);

 
}

void draw_images(image *image1, image *image2, image *image3, image *image4, image *image5, image *image6, image *image7, image *image8, image *image9, image *image10, image *image11, image *image12, BITMAP *GO, box *box1, box *box2, box *box3, box *box4, box *box5, box *box6, box *box7, BITMAP *curseur, BITMAP *Buffer)
{
draw_sprite(Buffer, image1->img, image1->x, image1->y);
draw_sprite(Buffer, image2->img, image2->x, image2->y);
draw_sprite(Buffer, image3->img, image3->x, image3->y);
draw_sprite(Buffer, image4->img, image4->x, image4->y);

draw_sprite(Buffer, image5->img, image5->x, image5->y);
draw_sprite(Buffer, image6->img, image6->x, image6->y);
draw_sprite(Buffer, image7->img, image7->x, image7->y);
draw_sprite(Buffer, image8->img, image8->x, image8->y);

draw_sprite(Buffer, image9->img, image9->x, image9->y);
draw_sprite(Buffer, image10->img, image10->x, image10->y);
draw_sprite(Buffer, image11->img, image11->x, image11->y);
draw_sprite(Buffer, image12->img, image12->x, image12->y);

 draw_sprite(Buffer , box1->bx, box1->x, box1->y);
draw_sprite(Buffer , box2->bx, box2->x, box2->y);
draw_sprite(Buffer , box3->bx, box3->x, box3->y);
draw_sprite(Buffer , box4->bx, box4->x, box4->y);
draw_sprite(Buffer , box5->bx, box5->x, box5->y);
draw_sprite(Buffer , box6->bx, box6->x, box6->y);
draw_sprite(Buffer , box7->bx, box7->x, box7->y);


//draw_sprite(Buffer , GO, 250, 250);

draw_sprite(Buffer, curseur, mouse_x, mouse_y);
}

void init_images(image *image1, image *image2, image *image3, image *image4, image *image5, image *image6, image *image7, image *image8, image *image9, image *image10, image *image11, image *image12, box *box1, box *box2, box *box3, box *box4, box *box5, box *box6, box *box7)
{
image1->x=123;
image1->x1=68;
image1->y=354;
image1->y1=291;

image2->x=447;
image2->x1=421;
image2->y=302;
image2->y1=269;

image3->x=414;
image3->x1=334;
image3->y=490;
image3->y1=432;


image4->y1=225;
image4->y=201;
image4->x1=254;
image4->x=216;

image5->x=346;
image5->y=194;
image5->x1=394;
image5->y1=216;


image6->x=684;
image6->y=345;
image6->x1=731;
image6->y1=381;

image7->x=568;
image7->y=289;
image7->x1=360;
image7->y1=320;

image8->x=246;
image8->y=233;
image8->x1=280;
image8->y1=257;

image9->x=704;
image9->y=299;
image9->x1=747;
image9->y1=318;

image10->x=34;
image10->y=225;
image10->x1=90;
image10->y1=307;

image11->x=708;
image11->y=90;
image11->x1=753;
image11->y1=131;

image12->x=151;
image12->y=371;
image12->x1=178;
image12->y1=441;


box1->y=540;
box2->y=519;
box3->y=540;
box4->y=519;
box5->y=540;
box6->y=519;
box7->y=540;

box1->x=16;
box2->x=126;
box3->x=239;
box4->x=352;
box5->x=465;
box6->x=578;
box7->x=687;

}

void clic(image *image1, image *image2, image *image3, image *image4, image *image5, image *image6, image *image7, image *image8, image *image9, image *image10, image *image11, image *image12, BITMAP *GO, box *box1, box *box2, box *box3, box *box4, box *box5, box *box6, box *box7, BITMAP *curseur, BITMAP *Buffer)
{
//mask
if (mouse_x < image2->x1 && mouse_x > image2->x && mouse_y < image2->y1 && mouse_y > image2->y && (mouse_b & 1))
{
  image2->x=840;
  image2->y=640;	
  box6->x=850;
  box6->y=850;	
}
      //bloody_saw
  if (mouse_x < image3->x1 && mouse_x > image3->x && mouse_y < image3->y1 && mouse_y > image3->y && (mouse_b & 1))
{
   image3->x=830;
   image3->y=630;	
   box2->x=870;
   box2->y=880;	
}
       //montre
 if (mouse_x < image4->x1 && mouse_x > image4->x && mouse_y < image4->y1 && mouse_y > image4->y && (mouse_b & 1))
{	
 image4->x=820;
 image4->y=620;	
 box7->x=860;
   box7->y=880;	
}
 
// Gun

 if (mouse_x < image5->x1 && mouse_x > image5->x && mouse_y < image5->y1 && mouse_y > image5->y && (mouse_b & 1))
{
 image5->x= 812;
 image5->y= 617;
 box3->x= 850;
 box3->y= 820;
}
//Notes
 if (mouse_x < image8->x1 && mouse_x > image8->x && mouse_y < image8->y1 && mouse_y > image8->y && (mouse_b & 1))
{

image8->x=811;
image8->y=613;
box5->x=870;
   box5->y=890;	

}
//Magnet
 if (mouse_x < image11->x1 && mouse_x > image11->x && mouse_y < image11->y1 && mouse_y > image11->y && (mouse_b & 1))   
{

image11->x=890;
image11->y=650;
box4->x=870;
   box4->y=820;	
}

//photos
if (mouse_x < image12->x1 && mouse_x > image12->x && mouse_y < image12->y1 && mouse_y > image12->y && (mouse_b & 1))
{
    image12->x=870;
    image12->y=670;
  box1->x=670;
   box1->y=830;	
}

if ((mouse_x < image1->x1 && mouse_x > image1->x && mouse_y < image1->y1 && mouse_y > image1->y && (mouse_b & 1)) || (mouse_x < image6->x1 && mouse_x > image6->x && mouse_y < image6->y1 && mouse_y > image6->y && (mouse_b & 1)) || (mouse_x < image7->x1 && mouse_x > image7->x && mouse_y < image7->y1 && mouse_y > image7->y && (mouse_b & 1)) || (mouse_x < image10->x1 && mouse_x > image10->x && mouse_y < image10->y1 && mouse_y > image11->y && (mouse_b & 1)) || mouse_x < image12->x1 && mouse_x > image12->x && mouse_y < image12->y1 && mouse_y > image12->y && (mouse_b & 1))
{

while(!key[KEY_ENTER] )
{
//draw_sprite(Buffer, GO, 170, 250);
//draw_sprite(Buffer , box7->bx, 250, 250);
blit(Buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);

}
}
}
